//
//  Mytable.m
//  FDSlideBarDemo
//
//  Created by 李挺哲 on 15/8/21.
//  Copyright (c) 2015年 fergusding. All rights reserved.
//

#import "Mytable.h"

@implementation Mytable

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

-(instancetype)init{
    
    
    if (self=[super init]) {
        [self setDataSource:self];
        [self setDelegate:self];
        _dataArray=[NSMutableArray array];
       
    }
    
    
    return self;

}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{

    return 1;

}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

    return _dataArray.count;

};


-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell;
    static NSString *ID=@"ID";
    cell=[tableView dequeueReusableCellWithIdentifier:ID];
    if (cell==nil) {
        cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
    }
    cell.textLabel.text=_dataArray[indexPath.row];
    return cell;
}

-(void)loadData{
    
    
    
    [_dataArray removeAllObjects];
    [_dataArray addObject:@"1"];
    [_dataArray addObject:@"1"];
    [_dataArray addObject:@"1"];
    [_dataArray addObject:@"1"];
    [self reloadData];
    
}
@end
